<?php
class ReferenceProxy {
	
	var $reference;
	var $context;
	
	function __construct($reference, $context) {
		$this->reference = $reference;
		$this->context = $context;
	}
	
	function invoke() {
		$return = TemplateReferenceCompiler::evaluateReference($this->context, $this->reference);
		
		if (! $return->evaluated)
			return null;
		
		return $return->value;	
	}
}
?>